package jdk7demo2;

import java.text.ParseException;
import java.text.SimpleDateFormat;

public class Test1 {
    public static void main(String[] args) throws ParseException {
        String str = "2023-03-01 12:00:00";
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        java.util.Date d = sdf.parse(str);
        System.out.println(d);
        method();
    }

    private static void method() {
        SimpleDateFormat sdf = new SimpleDateFormat();
        Date d = new Date(0L);
        String s = sdf.format(d.getTime());
        System.out.println(s);

        System.out.println("---------------------");

        SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss EE");
        String s2 = sdf2.format(d.getTime());
        System.out.println(s2);

        System.out.println("---------------------");
    }
}

class Date {
    private long time;

    public Date() {
    }

    public Date(long time) {
        this.time = time;
    }

    public long getTime() {
        return time;
    }

    public void setTime(long time) {
        this.time = time;
    }

    @Override
    public String toString() {
        return "Date{" + "time=" + time + '}';
    }

}